<?php

namespace App\Http\Controllers\OA;

use App\Http\Controllers\Controller;
use App\Http\Controllers\Logic\SupplierLogic;
use Illuminate\Http\Request;

class RegisterController extends Controller
{

    //供应商注册
    public function userRegister(Request $request)
    {
//        $pic = (new \App\Libs\UploadFile())->upload('Uploads/order');

        $rules = [
            'company'=>'required:string',
            'username'=>'required:string',
            'address'=>'required:string',
            'email'=>'required:string',
            'account'=>'required:string',
            'phone' => 'required|size:11',
            'password'=>'required:string',
            'repeatPassword'=>'required:string'
        ];

        $this->verify($request->all(),$rules);
        try{
            $logic = new SupplierLogic();
            $res = $logic->registerUser($request->all());
            ret_json('ok','ok',$res);
        }catch (\Exception $e){
            ret_json('err',$e->getMessage());
        }

    }
}
